package com.example.androidlib.wallet;


import com.example.androidlib.utils.Environment;

import org.web3j.protocol.Web3j;
import org.web3j.protocol.admin.Admin;
import org.web3j.protocol.http.HttpService;
import org.web3j.protocol.rx.Web3jRx;

/**
 * * Created by jambestwick@126.com
 * * on 2021/12/4
 * *
 */
public class Web3jInfo {

    private static  Web3j web3j;

    public static Web3j getWeb3j(){
        return  web3j;
    }
    /**
     * 必须先连接节点才能进行后续线上操作
     *
     * ***/
    public static Web3j connect(){
        web3j =  Web3j.build(new HttpService(Environment.RPC_URL));// 节点更改为自己的或者主网
        return web3j;
    }

    public static Admin connectAdmin(){
        return Admin.build(new HttpService(Environment.RPC_URL));
    }

    /***
     * 根据本地节点连接web3
     * **/
    public static Web3j connect(String localPointUrl){
        web3j = Web3j.build(new HttpService(localPointUrl));
        return web3j;
    }



}
